//
//  StudyTestViewController.swift
//  Auscultation
//
//  Created by 张文博 on 2021/4/14.
//

import UIKit

typealias ReTestClouse = ()-> Void

class StudyTestViewController: BaseVC {
    var reTestClouse: ReTestClouse?
    var model: TestFinishedModel = TestFinishedModel(){
        didSet{
            self.scoreL.text = model.score.string
            self.creatTimeL.text = model.examBeginTimeString
            self.testTimeL.text = model.testTimeString
            if model.pass {
                self.resultL.text = "考试通过"
                self.iconImage.image = UIImage(named: "chenggong")

            }else{
                self.resultL.text = "考试未通过"
                self.iconImage.image = UIImage(named: "shibai")

            }
        }
    }
    
    @IBOutlet weak var iconImage: UIImageView!
    @IBOutlet weak var resultL: UILabel!
    @IBOutlet weak var creatTimeL: UILabel!
    @IBOutlet weak var scoreL: UILabel!
    @IBOutlet weak var reTextBtn: UIButton!
    @IBOutlet weak var testTimeL: UILabel!
    @IBAction func reTestClick(_ sender: UIButton) {
        reTestClouse?()
        self.navigationController?.popViewController(animated: true)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        let top_view = UIImageView()
        top_view.image = UIImage(named: "table2")
        top_view.isUserInteractionEnabled = true
        self.view.addSubview(top_view)
        top_view.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(UIDevice.lgf_NavBarH())
        }
        isScreenPanPopEnabled =  false
        self.navTitle = "测试结果"
        let style = LGFNavigationBarStyle.lgf()
        style.lgf_LeftBtnImageLight = UIImage(named: "darkback")!
        self.lgf_NavigationBar.lgf_line?.isHidden = true
    }

    @objc override func leftBtnSelect() {
        self.navigationController?.popToRootViewController(animated: true)
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
